home *** CD-ROM | disk | FTP | other *** search
/ SunSoft Catalyst CDWARE 1996 May to August / Catalyst CDWARE 1996 May to August.iso / .products / .bin / httpd / Solaris_1 / tarfiles.pl < prev    next >
Perl Script  |  1996-02-29  |  8KB  |  192 lines

  1. #!./perl
  2.  
  3. # ------------------------------------------------------------
  4.  
  5. # tarfiles.pl, by Jean-Pierre Girard (jpg@corrado.sun.com)
  6. # This allows the development environment to choose what
  7. # page to load depending on the existence of .cdev
  8.  
  9. # ------------------------------------------------------------
  10.  
  11. # Bugs and other fixes
  12.  
  13. # ------------------------------------------------------------
  14.  
  15. ##############################################################################
  16. # main
  17. ##############################################################################
  18. $BASEDIR = $ENV{"DOCUMENT_ROOT"};
  19. require 'devinfo.pl';
  20. require 'tools.pl';
  21. $IMAGE_GR_BUL = "<IMG ALIGN=middle src=\"file:///tmp/httpd/.products/DEV/images/bullet_ball_green.gif\">";
  22. $IMAGE_RED_BUL = "<IMG ALIGN=middle src=\"file:///tmp/httpd/.products/DEV/images/bullet_ball_red.gif\">";
  23. if ($ENV{'REQUEST_METHOD'} eq "POST") {
  24.     read(STDIN, $request, $ENV{'CONTENT_LENGTH'});
  25. } elsif ($ENV{'REQUEST_METHOD'} eq "GET" ) {
  26.     $request = $ENV{'QUERY_STRING'};
  27. }
  28.  
  29. $HomeDir = &GetDevinfo("dir");
  30. #$TARFILE = $HomeDir . "/../cdware.tar";
  31. $ShortDir = $HomeDir;
  32. $ShortDir =~ s?.*/([^/]*)$?\1?;
  33.  
  34. $~ = HEADER;
  35. write;
  36. $Status=1;
  37. $request =~ s/%(..)/pack("c",hex($1))/ge;
  38. #print "request=$request<br>";
  39. #print "ARGV0=$ARGV[0]<br>";
  40. #if (@ARGV == 0 && $request eq "") {
  41.  
  42.  
  43. if ($request ne "") {
  44.     if ($request =~ /^FTPDEV/) {
  45.         #print "in case request=tapedev<br>";
  46.         $Device = $request;
  47.         $Device =~ s/FTPDEV=//;
  48.         $TarFile = $HomeDir;
  49.         $TarFile =~ s?.*/([^/]*)$?\1.tar?;
  50.         #$TarFile = "$BASEDIR/$TarFile";
  51.         $Status = system ("cmdtool csh -c 'cd $BASEDIR;tar cvf $TarFile $ShortDir;rm -f $TarFile.Z;compress $TarFile;echo \" \";echo \"The size of the file to send is (in Kb): \"`du -ks $TarFile.Z`;echo \" \";echo \"READ THIS: Please ftp this file.\";echo \" \";echo \"The ftp site is xm.com (open xm.com).\";echo \"The login name is \'cdware\'. The password is \'jan1995\'.\";echo \"Just copy your file ($TarFile.Z) in the current directory:\";$Device;echo \" \";echo \"Press <Return> to close this window...\";read a'");
  52.         #print "Status=$Status<br>";
  53.     }
  54.     if ($request =~ /^TAPEDEV/) {
  55.         #print "in case request=tapedev<br>";
  56.         $Device = $request;
  57.         $Device =~ s/TAPEDEV=//;
  58.         if (-c $Device) {
  59.             #print "cmdtool /bin/csh \<echo \"test\"";
  60.             $TarFile = $HomeDir;
  61.             $TarFile =~ s?.*/([^/]*)$?\1.tar?;
  62.             #$TarFile = "$BASEDIR/$TarFile";
  63.             $Status = system ("cmdtool csh -c 'cd $BASEDIR;tar cvf $TarFile $ShortDir;rm -f $TarFile.Z;compress $TarFile;echo \"The size of the file to send is (in Kb): \"`du -ks $TarFile.Z`;echo \" \";echo \"Copying file on tape:\";tar cvf $Device $TarFile.Z;echo \" \";echo \"Press <Return> to close this window...\";read a'");
  64.             #print "Status=$Status<br>";
  65.         } else {
  66.             $Status = &PrintErr("NoDevice", $Device);
  67.             $ARGV[0] = "TAPE";
  68.         }
  69.     }
  70.     if ($request =~ /^DISKDEV/) {
  71.         #print "in case request=tapedev<br>";
  72.         $Device = $request;
  73.         $Device =~ s/DISKDEV=//;
  74.         if (-c $Device) {
  75.             #print "cmdtool /bin/csh \<echo \"test\"";
  76.             $TarFile = $HomeDir;
  77.             $TarFile =~ s?.*/([^/]*)$?\1.tar?;
  78.             #$TarFile = "$BASEDIR/$TarFile";
  79.             $Status = system ("cmdtool csh -c 'cd $BASEDIR;tar cvf $TarFile $ShortDir;rm -f $TarFile.Z;compress $TarFile;echo \"The size of the file to send is (in Kb): \"`du -ks $TarFile.Z`;echo \" \";echo \"Copying file on diskette(s):\";echo \"$TarFile.Z\"|cpio -uo -O $Device;echo \" \";echo \"Press <Return> to close this window...\";read a'");
  80.             #print "Status=$Status<br>";
  81.         } else {
  82.             $Status = &PrintErr("NoDevice", $Device);
  83.             $ARGV[0] = "DISKETTE";
  84.         }
  85.     }
  86. }
  87. if ($ARGV[0] ne "") {
  88.     if ($ARGV[0] eq "FTP") {
  89.         print "<hr>Please enter your ftp command name:"
  90.         , "<FORM method=\"post\"  ACTION=\"http://localhost:7999/cgi-bin/tarfiles.pl?\">"
  91.         ,"<INPUT TYPE=\"text\" NAME=\"FTPDEV\" VALUE=\""
  92.         ,($Device ne ""?$Device:"ftp"), "\" SIZE=\"20\" MAXLENGTH=50>"
  93.         ," <input type=\"submit\" VALUE=\"Send\" > </FORM>"
  94.     } elsif ($ARGV[0] eq "TAPE") {
  95.         print "<hr>Please enter your device name:"
  96.         , "<FORM method=\"post\"  ACTION=\"http://localhost:7999/cgi-bin/tarfiles.pl?\">"
  97.         ,"<INPUT TYPE=\"text\" NAME=\"TAPEDEV\" VALUE=\""
  98.         ,($Device ne ""?$Device:"/dev/rst5"), "\" SIZE=\"20\" MAXLENGTH=50>"
  99.         ," <input type=\"submit\" VALUE=\"Copy on tape\" > </FORM>"
  100.     } elsif ($ARGV[0] eq "DISKETTE") {
  101.         print "<hr>Please enter your diskette drive name:"
  102.         , "<FORM method=\"post\"  ACTION=\"http://localhost:7999/cgi-bin/tarfiles.pl?\">"
  103.         ,"<INPUT TYPE=\"text\" NAME=\"DISKDEV\" VALUE=\""
  104.         ,($Device ne ""?$Device:"/dev/rdiskette"), "\" SIZE=\"20\" MAXLENGTH=50>"
  105.         ," <input type=\"submit\" VALUE=\"Copy on diskette\" > </FORM>";
  106.         print "<p><img ALIGN=middle src=\"file:///tmp/httpd/.products/DEV/images/finger.gif\">Before clicking on the button, you need to stop the volume manager:<br><ol><li>Become superuser<br><li>Type the command: <tt>/etc/init.d/volmgt stop</tt><li>Check that the volume manager is stopped by typing the command: <tt>ps -ea|grep vold</tt>. You shouldn't get any return. If vold is still running, one of your applications must be using it and need to be exited.<li>Once the volume manager is stopped, you can insert a diskette in your drive and press the button \"Copy on diskette\".<li>To restart the volume manager, enter the following command: <tt>/etc/init.d/volmgt start</tt>.</ol>";
  107.     }
  108. }
  109. if ($ARGV[0] eq "" && $request eq "") {
  110.     unless (-s $HomeDir . "/_info") {
  111.         &PrintErr("NoExist", "$HomeDir/_info");
  112.     }
  113.     unless (-s $HomeDir . "/index.html") {
  114.         &PrintErr("NoExist", "$HomeDir/index.html");
  115.     }
  116.     print "<h2>Are you sure you are done with your insertion?</h2>";
  117.     print "<ul><H4>$IMAGE_RED_BUL<a href=\"http://localhost:7999/cgi-bin/mainmenu.pl?\">Go back to main menu</a></H4>";
  118.     print "<p>$IMAGE_RED_BULChoose how you will send your insertion to Sun Microsystems:</p><ol>";
  119.     print "<H2>$IMAGE_GR_BUL<a href=\"http://localhost:7999/cgi-bin/tarfiles.pl?FTP\">Using ftp</a></H2>";
  120.     print "<H2>$IMAGE_GR_BUL<a href=\"http://localhost:7999/cgi-bin/tarfiles.pl?TAPE\">Using a tape</a></H2>";
  121.     print "<H2>$IMAGE_GR_BUL<a href=\"http://localhost:7999/cgi-bin/tarfiles.pl?DISKETTE\">Using diskettes</a></H2></ol></ul>";
  122.  
  123. } elsif ($Status == 0) {
  124.     $~ = FINISHED;
  125.     write;
  126. }
  127.  
  128.  
  129.     $~ = FOOTER;
  130.     write;
  131.  
  132.  
  133. ##############################################################################
  134. # formats
  135. ##############################################################################
  136. format HEADER =
  137. Content-type: text/html
  138.  
  139.  
  140. <html>
  141. <title>Developer's Kit</title>
  142. <body>
  143. <h1>CDware Developer's Kit</h1>
  144. <h4>Currently working with "@*
  145. $HomeDir
  146. "</h4>
  147. #<ol type=1>
  148. .
  149.  
  150. format FOOTER =
  151. #</ol>
  152. <p>
  153. <hr>
  154. <p>
  155. You, like these companies, will benefit from the CDware capability of reaching tens of thousands of potential customers with information, links to your web site, or directly with YOUR product!
  156. <p><app class=ImageTape width=596 height=65 img_dir=../../../DEV/logos speed=10 dir=-10
  157. url1=oracle
  158. url2=progress
  159. url3=gupta
  160. url4=informix
  161. url5=lotus
  162. url6=ingres
  163. >
  164. </b>
  165. <h5><p><A HREF=file:///tmp/httpd/.products/CDware/Help/SMICopyright.html>Copyright</A> 1995 Sun Microsystems, Inc., 2550 Garcia Ave., Mtn. View, CA 94043 USA.  All rights reserved.</h5><br></pre>
  166. <a href=file:///tmp/httpd/.products/DEV/credits.html>Credits</a>
  167. </b>
  168. </form>
  169. </body>
  170. </html>
  171. .
  172.  
  173. format FINISHED =
  174. </ol>
  175. <p>
  176. <h1><app class="ImageLoopItem" ALIGN=middle width=55 height=68 img="file:///tmp/httpd/.products/DEV/images/duke">You're done!</h1>
  177. <p>Please submit your tape or diskette to:<br>
  178. <b>Jason Incorvaia (415-336-1920)<br>
  179. 2550 Garcia Ave.<br>
  180. MS-UMTV08<br>
  181. Mountain View, CA 94043-1100<br></b>
  182. <h3>Please send us an Email to let us know that we should expect your insertion: <A href="mailto:cdware@sun.com">cdware@sun.com</A></h3>
  183. "@", "@"
  184. <p><app class="ImageLoopItem" img="file:///tmp/httpd/.products/DEV/images/blinkingAlert" ALIGN=middle pause=0 width=56 height=49 pause = 200>Once you sent us an Email, you can just quit hotjava or use it to browse the web!</p>
  185. <p>
  186. <ul>
  187. <H4><IMG ALIGN=middle src="file:///tmp/httpd/.products/DEV/images/bullet_ball_green.gif"><a href="http://localhost:7999/cgi-bin/mainmenu.pl?">Main menu</a></H4>
  188. <H4><IMG ALIGN=middle src="file:///tmp/httpd/.products/DEV/images/bullet_ball_green.gif"><a href="http://www.sun.com">Sun's home page</a></H4>
  189. </ul>
  190. .
  191.  
  192.